<?php

/**
 * Users Controller
 *
 * PHP 5
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the below copyright notice.
 *
 * @author     Yusuf Abdulla Shunan <shunan@maldicore.com>
 * @copyright  Copyright 2012, Maldicore Group Pvt Ltd. (http://maldicore.com)
 * @license    MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @since      CakePHP(tm) v 2.1.1
 */
App::uses('AdminAppController', 'Admin.Controller');
App::uses('AppController', 'Controller');

class AuthorizeSettingsController extends AdminAppController {

    var $name = 'AuthorizeSettings';
    var $helpers = array('Form');

    function index() {
        $this->loadModel('AuthorizeSettings');
        $post = $this->AuthorizeSettings->find('first');
        if ($this->request->is(array('post', 'put'))) {
            if ($post) {
                $this->AuthorizeSettings->id = $post['AuthorizeSettings']['id'];
            } else {
                $this->AuthorizeSettings->create();
            }
            if ($this->AuthorizeSettings->save($this->request->data)) {
                $this->Session->setFlash('Settings has been updated.!', 'default', array(), 'good');
                return $this->redirect(array('action' => 'index'));
            }
            $this->Session->setFlash('Unable to update settings.!', 'default', array(), 'bad');
            $post = $this->AuthorizeSettings->find('first');
        }
        $this->set('data', $post);
    }

}
